//
//  ViewControllerOne.m
//  testRN
//
//  Created by Juvid on 2017/3/15.
//  Copyright © 2017年 Facebook. All rights reserved.
//

#import "ViewControllerOne.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
@interface ViewControllerOne ()

@end

@implementation ViewControllerOne

- (void)viewDidLoad {
  [super viewDidLoad];
  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  NSString *documentDirectory = [paths objectAtIndex:0];
  NSLog(@"沙盒路径：%@",documentDirectory);
  self.edgesForExtendedLayout=UIRectEdgeNone;
  self.title=@"New";
  NSURL *jsCodeLocation;
//  =[NSURL URLWithString:@"http://192.168.8.22:8081/juvid.bundle?platform=ios&dev=true&minify=false"];
//  [RCTBundleURLProvider sharedSettings].jsLocation=@"192.168.8.18";
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:@"index.ios"];

//    jsCodeLocation= [[NSBundle mainBundle] URLForResource:@"index.ios" withExtension:@"jsbundle"];
//  NSString *str=[NSString stringWithFormat:@"%@",jsCodeLocation];
//  UIAlertView *alr=[[UIAlertView alloc]initWithTitle:@"提示" message:str delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil];
//  [alr show];
  NSDictionary *properties=@{@"zhu":@"111",@"tian":@"222",@"wei":@"333"};
  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"testRN"
                                               initialProperties:properties
                                                   launchOptions:nil];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];
  self.view=rootView;

  // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
